<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body>
    <div id="app"></div>
    <template id="pengfan">
      <!-- 默认传入的event对象，可以在方法中获取 -->
      <button @click="btn1Click">按钮1</button>
      <!-- $event可以获取到事件发生时的事件对象 -->
      <button @click="btn2Click($event,'pengfan',18)">按钮2</button>
    </template>
    <script src="../js/vue.js"></script>
    <script>
      Vue.createApp({
        template: "#pengfan",
        data() {
          return {
            message: "Hello World",
          };
        },
        methods: {
          btn1Click(event){
            console.log(event);
          },
          btn2Click(event,name,age){
            console.log(name,age,event);
          }
        },
      }).mount("#app");
    </script>
  </body>
</html>
